﻿/*------------------------------------------------
// File Description: LoginHistory DataBase Entity
// Author:			 汪亮
// Create Time:		 2020-02-04 04:46:05
//------------------------------------------------*/

using System;
using System.Data.Entity;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace IOA.MES.Log.DataAccess.Entity
{
    /// <summary>
    /// 登录记录
    /// </summary>
    [Table(nameof(LoginHistory))]
    public class LoginHistory : BaseEntity
    {
        private string _clientIP = string.Empty;
        private string _userAgent;

        #region Public Property

        ///<Summary>
        /// 用户ID
        ///</Summary>
        public int UserId { get; set; }

        ///<Summary>
        /// 登录时间
        ///</Summary>
        public DateTime LoginTime { get; set; }

        ///<Summary>
        /// 设备类型
        ///</Summary>
        public Enum.DeviceType DeviceType { get; set; }

        ///<Summary>
        /// 客户端类型
        ///</Summary>
        public Enum.ClientType ClientType { get; set; }

        ///<Summary>
        /// 客户端IP
        ///</Summary>
        public string ClientIP
        {
            get { return string.IsNullOrWhiteSpace(_clientIP) ? string.Empty : _clientIP; }
            set { _clientIP = value; }
        }

        ///<Summary>
        /// 客户端信息
        ///</Summary>
        public string UserAgent
        {
            get { return string.IsNullOrWhiteSpace(_userAgent) ? string.Empty : _userAgent; }
            set { _userAgent = value; }
        }
        #endregion
    }

    public partial class MESLogContext
    {
        /// <summary>
        /// 登录记录
        /// </summary>
        public virtual DbSet<LoginHistory> LoginHistories { get; set; }
    }
}